<template>
	<view class="box">
		<view v-if="is_load">
			<v-evaluate :all="true" :info="item" v-for="item in data_list" :key="item.id"></v-evaluate>
			<view class="flex7 font_27 color_999" style="height: 100rpx;">{{Text}}</view>
		</view>
	</view>
</template>

<script>
	import evaluate from './component/evaluate.vue';

	export default {
		components: {
			'v-evaluate': evaluate
		},
		data() {
			return {
				id: '',
				page: 1,
				Text: '',
				data_list: [],
				is_load: false,
				is_last_page: false,
			}
		},
		onLoad(e) {
			this.id = e.id;
			this.getEvaluateByStoreId();
		},
		onReachBottom() { //上拉加载
			if (!this.is_last_page) {
				this.page++;
				this.Text = '加载中...';
				this.getCouponList();
			}
		},
		methods: {
			getEvaluateByStoreId() {
				this.$http.get(this.$api.getEvaluateByStoreId, {
					page: this.page,
					store_id: this.id
				}).then(res => {
					this.is_load = true;
					this.data_list = this.data_list.concat(res.data.data);

					if (this.page == res.data.last_page) {
						this.is_last_page = true;
						this.Text = '已加载全部'
					} else {
						this.is_last_page = false;
					}
				})
			}
		}
	}
</script>

<style lang="less">
	.box {
		padding: 0 48rpx;
		box-sizing: border-box;
	}
</style>
